<?php if (!defined('THINK_PATH')) exit();?>﻿<!DOCTYPE html>
<html lang="ZH-cn">
<head>
  <meta charset="UTF-8">
 <!--  <meta http-equiv="X-UA-Compateble" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1，maximum-scale=1,user-scalable=no"> 响应式 拒绝底部滑动条-->
  <title>回忆是一种幸福</title>
  <link href="/mydemo/Public/css/bootstrap.min.css" rel="stylesheet">
  <link href="/mydemo/Public/css/style.css" rel="stylesheet">
  <link rel="stylesheet" href="/mydemo/Public/css/font-awesome.min.css">
  <link rel="stylesheet" href="/mydemo/Public/css/animate.min.css">
  <link rel="stylesheet" href="/mydemo/Public/css/overwrite.css">
  <style>
      *{font-family: "Microsoft Yahei";font-size: 14px;}
  body{width:auto; min-width: 1200px;height: 100%; background: #fff;}
  .head_wrap{height: 120px;background: #fff;width:1200px;margin:0 auto;}
  .head_logo{min-width:360px;height: 120px;}
  .head_logo img{width:220px;height: 100px;margin-left: 100px;margin-top: 10px;cursor:pointer;}
  .head_logo h1{color: #F97B06}
  .head_search{margin-top: 40px;}
  .head_search .btn{border-top:1px solid rgb(204,204,204);border-bottom:1px solid rgb(204,204,204);padding-top:6px;}
  .center_wrap{background: #DDD;width:1200px;margin:0 auto;height: 100%}
  .center_title{width:100%;background-color: #ccc;height:40px;line-height: 40px; border-bottom :1px solid #fff;}
  .center_title span:first-child{font-size: 20px;padding-left:12px;}
  .center_title a{padding-right:12px; color: #000}
  .center_title span {font-weight: bolder;}
  .title{width: 100%;float: left;position: relative;min-height: 1px;}
  .largeImg{text-align: center}
  .largeImg .largeImgContent{max-width:100% !important; cursor: pointer }/*max-height: 800px;可设高度限制*/
    .footer_wrap{width: 1200px;margin:0 auto}
  </style>
 <script src="/mydemo/Public/js/jquery-2.1.1.min.js"></script>
</head>
<body>
    <div class="page-content">
    
<style type="text/css">

.col-xs-12  {
   margin: 10px;
}
/*.login{
   background: rgba(0,0,0,.3);
}*/
.register{
   background: #aaa;
}
.form-group>.input-group{
   margin-left: 25%
}
.box_header{
   width:50%;
   margin:20px auto 0;
   background: #ccc;
   height:40px;
   line-height: 40px;

}
</style>


        <!-- 全局头部文件 -->
  <div class="top-nav">
<nav class="navbar navbar-default" role="navigation">
   <div class="navbar-header">
      <a class="navbar-brand" href="<?php echo u('Index/index');?>">首页</a>
   </div>
   <div>
      <ul class="nav navbar-nav">
     <!--  <?php echo ($Think['session']['users']['user_name']); ?> -->
      <?php if(Think.session.users.user_name == ''): ?><li ><a href="#" onclick="alert_developed('登陆')">登陆</a></li><?php endif; ?>  
         <li><a href="#"  onclick="alert_developed('我的相册')">我的相册</a></li>
         <li><a href="<?php echo u('User/user_list');?>" >用户列表</a></li>
         <li class="dropdown">
            <a href="<?php echo u('User/userlist');?>" class="dropdown-toggle"   data-toggle="dropdown">
               <?php echo ((isset($_SESSION['users']['user_name']) && ($_SESSION['users']['user_name'] !== ""))?($_SESSION['users']['user_name']):'用户中心'); ?>
               <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
               <li><a href="<?php echo u('User/index');?>">个人中心</a></li>
               <li><a href="#">上传图片</a></li>
               <li><a href="/mydemo/index.php/Picture/wall">图片墙</a></li>
               <li class="divider"></li>
               <li><a href="#">我的好友</a></li>
               <li><a href="#">我的留言</a></li>
               <li class="divider"></li>
               <li><a href="<?php echo u('Login/logout');?>">退出登陆</a></li>
            </ul>
         </li>
      </ul>
   </div>
</nav> 
  </div> 


  



        
  <div class="head_wrap row">
    <div class="head_logo col-sm-12 text-center">
      <!-- <img src="/mydemo/Public/img/lunbo_02.jpg" alt=""> -->
      <h1>我们的回忆从这里开始！</h1>
    </div>

  </div>
  <div class="login_container" style="margin:0 auto; width:1200px;">
      <div class="col-sm-6 login" style="">
         <h3 class="box_header">登录</h3>
         <div class="groupimg_content">
            <div class="row" >
               <div class="login-content col-sm-12">
                  <div class="form">
                     <form action="<?php echo u('checkLogin');?>" method="post">
                     <input type="hidden" name="state" id="state" value="1">
                        <div class="form-group">                         
                              <div class="input-group col-sm-6">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
                                 <input type="text" id="username" name="username"  class="form-control " placeholder="用户名">
                              </div>                        
                        </div>
                        <div class="form-group">                         
                           <div class="input-group col-sm-6">
                              <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                              <input id="password" name="password" type="password" class="form-control" placeholder="密码">
                           </div>                         
                        </div>
                        <div class="form-group form-action col-sm-6">
                           <div class="col-xs-4 col-xs-offset-4 ">
                              <button type="submit" id="sub_login" class="btn btn-sm btn-info"><span class="glyphicon glyphicon-off"></span> 登录</button>
                           </div>
                        </div>
                     </form>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <div class="col-sm-6 register" >
         <h3 class="box_header">注册</h3>
         <div class="groupimg_content">     
            <div class="row" >       
               <div class="login-content col-sm-12">
                  <div class="form">
                     <form  id="sub_form" method="post">
                        <div class="form-group">
                              <div class="input-group col-sm-6">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
                                 <input type="text" id="re_username" name="re_username" class="form-control " placeholder="用户名(必填)">
                              </div>
                        </div>
                        <div class="form-group">
                              <div class="input-group col-sm-6">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                                 <input  id="re_password" name="re_password" type="password" class="form-control" placeholder="密码(必填)">
                              </div>
                        </div>
                        <div class="form-group">
                              <div class="input-group col-sm-6">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                                 <input id="re_old_password" name="re_old_password" type="password" class="form-control" placeholder="密码确认(必填)">
                              </div>
                        </div>

                        <div class="form-group">
                              <div class="input-group col-sm-6">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                                 <input type="text" id="re_email" name="re_email" class="form-control" placeholder="电子邮箱(选填)">
                              </div>
                        </div>

                        <div class="form-group">
                              <div class="input-group col-sm-6">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                                 <input type="text" id="re_code" name="re_code" class="form-control" placeholder="验证码(必填)"><img id="getcode_math" src="<?php echo u('get_code');?>" title="看不清，点击换一张" style="cursor:pointer"  onerror="" alt="..." />
                              </div>
                        </div>

                        <div class="form-group">
                              <div class="input-group col-sm-6">
                               <span id = "error_msg"></span>
                              </div>
                        </div>
                        <div class="form-group form-action col-sm-6">
                           <div class="col-xs-4 col-xs-offset-4 ">
                              <button type="button" id="re_submit" class="btn btn-sm btn-info"><span class="glyphicon glyphicon-off"></span> 注册</button>
                           </div>
                        </div>
                     </form>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>

          
<script type="text/javascript">
var url = '<?php echo u("register");?>';
   $(function(){
   //验证码刷新
      $("#getcode_math").click(function(){
         $(this).attr("src","<?php echo u('get_code');?>?" + Math.random());
      });


   //注册验证
   $('#re_username').blur(function(){
      var re_username = $(this).val();
      if(re_username.length<4 || re_username.length>20){
         $('#error_msg').html('用户名必须大于4位，小于20位!').css({'color':'red','font-weight': 'block;'});
         $(this).focus().val('');
         setTimeout(function(){
             $('#error_msg').html('');
         },1000)
      }
   })
   $('#re_password').bind('blur',function(){
      var re_password = $(this).val();
     if(re_password.length < 4 || re_password.length >16){
       $('#error_msg').html('密码必须大于4位，小于16位!').css({'color':'red','font-weight': 'block;'});
         $(this).focus().val('');
         setTimeout(function(){
             $('#error_msg').html('');
         },1000)
     }
   });

    $('#re_old_password').bind('blur',function(){
      var re_old_password = $(this).val();
      var re_password = $('#re_password').val();
     if(re_old_password.length < 4 || re_old_password.length >16){
       $('#error_msg').html('密码确认必须大于4位，小于16位!').css({'color':'red','font-weight': 'block;'});
         $(this).focus().val('');
         setTimeout(function(){
             $('#error_msg').html('');
         },1000)
     }
     if(re_old_password !== re_password){
       $('#error_msg').html('两次输入的密码不一致').css({'color':'red','font-weight': 'block;'});
         $(this).focus().val('');
         setTimeout(function(){
             $('#error_msg').html('');
         },1000)
     }
   });

     $('#re_email').bind('blur',function(){
        var re_email = $(this).val();
        if(re_email!=""){
        　var reg = /^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$/;
      　　if (!reg.test(re_email)) {
                $('#error_msg').html('电子邮箱不合法').css({'color':'red','font-weight': 'block;'});
                  $(this).focus().val('');
                  setTimeout(function(){
                      $('#error_msg').html('');
                  },1000);
      　　}
      } 
     });
     

     //提交表单
      $('#re_submit').click(function(){
        var re_username = $('#re_username').val();
        var re_password = $('#re_password').val();
        var re_old_password = $('#re_old_password').val();
         var re_code = $('#re_code').val();
         if(re_username==""){
           error_msg('用户名不能为空');
           return;
         }
         if(re_password==""){
           error_msg('密码不能为空');
           return;
         }
         if(re_old_password==""){
           error_msg('密码确认不能为空');
           return;
         }
         if(re_code==""){
           error_msg('验证码不能为空');
           return;
         }
         var data = $('#sub_form').serialize();
         $.ajax({
           url: url,
           type: 'POST',
           dataType: 'json',
           data: data,
           success: function(data) {
            //自动登陆
            if(data.code =1){
               $('#error_msg').html(data.msg).css({'color':'green','font-weight': 'block;'});
                  setTimeout(function(){
                      $('#error_msg').html('');
                  },1000);
                 $('#username').val(data.username);
                 $('#password').val(data.password);
                 $('#state').val(2);
                 $('#sub_login').click();
            }
             if(data.code =2){
               error_msg(data.msg);
             }
           },
           error: function(data) {
             //called when there is an error
           },
           complete: function(xhr, textStatus) {
             //called when complete
           }
           
         });
         
      })
   })

//提示信息
function error_msg(data){
   $('#error_msg').html(data).css({'color':'red','font-weight': 'block;'});
         $(this).focus().val('');
         setTimeout(function(){
             $('#error_msg').html('');
   },1000);
}

</script>

        <div id="footer">
    <div class="footer1">
    <div class="title">
      <p class="center_title">
        <span>友情链接</span>
      </p>

    </div>
      <div style="clear: both;"></div>
      <div id="friend_link">
        <a target="_blank" href="http://www.chengzhier.com">橙汁儿电影网</a>
        <a target="_blank" href="http://zhixing.zxtms.net">知行工作室</a>
        <a target="_blank" href="http://www.huanyan520.com">焕言工作室</a>
        
        <a target="_blank" href="http://www.urionz.com">有时梦游博客</a>
      </div>
    </div>
    
    <div class="footer2">
      <div class="wrap">
        <p></p>
        <p>© 2016 <a href="http://www.chengzhier.com/" title="Sun"><strong>Sun</strong></a>. All rights reserved.</p>
        <p></p>
        
        <p> 技术支持 <strong style="color: #ff7d00;">Song、Zhou</strong></p>
        <p></p>
        <p>该网站的自图片都来自与<strong style="color: #ff7d00;">sunqiu</strong>收藏，记录身边的成长</p>
      </div>
    </div>
  </div>
 <script src="/mydemo/Public/js/bootstrap.min.js"></script>
  <script src="/mydemo/Public/js/parallax.min.js"></script>
  <script src="/mydemo/Public/js/wow.min.js"></script>
  <script src="/mydemo/Public/js/jquery.easing.min.js"></script>
  <script type="text/javascript" src="/mydemo/Public/js/fliplightbox.min.js"></script>
  <script src="/mydemo/Public/js/functions.js"></script>
  <script type="text/javascript" src="/mydemo/Public/layer/layer.js"></script>
  <script type="text/javascript">
    function alert_developed(data){
        alert(data+"待开发，敬请期待");
        return false;
      }
</script>


        

    </div>
</body>
</html>